name: Automate area labels
on:
  - pull_request_target

permissions:
  contents: read

jobs:
  triage:
    permissions:
      contents: read # for actions/labeler to determine modified files
      pull-requests: write # for actions/labeler to add labels to PRs
    runs-on: ubuntu-latest
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
        with:
          egress-policy: audit

      - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
        with:
          repo-token: '${{ secrets.GITHUB_TOKEN }}'
          sync-labels: true
